package com.com.lagou.task13;


    public class Worker {
    private String name;
    private int age;
    private double salary;

    public Worker() {
        super();

    }

    public Worker(String name, int age, double salary) {
        super();
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public void work() {
        System.out.println(this.getName() + "正在工作");

    }

    @Override
    public String toString() {
        return "Worker [name=" + name + ", age=" + age + ", salary=" + salary
                + "]";
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + age;
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        long temp;
        temp = Double.doubleToLongBits(salary);
        result = prime * result + (int) (temp ^ (temp >>> 32));
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        Worker w = (Worker)obj;
        return this.name.equals (w.name) && this.age == w.age && this.salary == w.salary;
    }

}

